package com.itheima.a04polymorphismdemo04;

/***
 *@title Test
 *@description <TODO description class purpose>
 *@author 12468
 *@version 1.0.0
 *@create 2024/10/24 0:26
 **/
public class Test {
    public static void main(String[] args) {
        // Person p1 = new Person("老王", 30);
        // Dog d = new Dog("黑色", 2);
        // p1.peekPet(d, "骨头");
        //
        // System.out.println("-------------------------------+++------------------");
        //
        // Person p2 = new Person("老王", 30);
        // Cat c = new Cat("灰", 3);
        // p2.peekPet(c, "鱼");

        // 多态的使用
        Person p = new Person("老王", 30);
        Dog d = new Dog("黑色", 2);
        Cat c = new Cat("灰", 3);
        p.peekPet(d, "骨头");
        p.peekPet(c, "鱼");

    }
}
